package com.atguigu.statistic.controller;

import com.atguigu.commonutils.result.R;
import com.atguigu.statistic.service.StatisticsDailyService;
import com.atguigu.statistic.vo.SearchObj;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * @author kabuda
 * @create 2023-05-20 16:16
 */
@RestController
@RequestMapping(value = "edustatistic")
public class StatisticsController {
    @Autowired
    private StatisticsDailyService statisticsDailyService;

    @GetMapping("updateDetail")
    public R statistic(@RequestParam("date") String date){
        statisticsDailyService.updateDetail(date);
        return R.ok();
    }

    @PostMapping("getChart")
    public R getChart(@RequestBody SearchObj searchObj){
        Map<String, Object> map= statisticsDailyService.getChart(searchObj);
        return R.ok().data(map);
    }

}
